package com.mc.designpattern.strategy.util;

import lombok.Data;
import lombok.Setter;
import lombok.experimental.Accessors;

/***
 * @ClassName Channel
 * @Description 订单来源
 * @Author CC
 * @Date: 2019/10/3011:09
 * @Version 1.0
 */
@Data
@Setter
@Accessors(chain = true) //可以使用this链式调用
public class Channel {
    public static final int AU = 1;//奥克斯
    public static final int UC = 2;//优速
    public static final int JD = 2;//京东
    private Integer type;//订单来源
    private String name;
    private Double price;

    public static Channel build() {
        return new Channel();
    }

    public Channel add(String filed, Object value) {
        switch (filed) {
            case "name":
                this.setName(String.valueOf(value));
                break;
            case "price":
                this.setPrice((Double) value);
                break;
            case "type":
                this.setType((Integer) value);
                break;
        }
        return this;
    }


    private Channel() {
    }
}
